package com.ossjk.qlh.minapp.controller;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.ossjk.core.base.controller.BaseController;
import com.ossjk.core.util.CommonUtil;
import com.ossjk.core.vo.RequestBean;
import com.ossjk.core.vo.ResponseBean;
import com.ossjk.qlh.minapp.entity.MenuVO;
import com.ossjk.qlh.minapp.service.IMenuService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 *  
 * 菜单
 * @author liuxi
 * @since 2020-08-15
 */
@Api(tags = "菜单")
@RestController
@RequestMapping("/api/menu")
public class MenuController extends BaseController {
	
	@Autowired
	private IMenuService iMenuService;

	@ApiOperation(value = "菜单首页")
	@PostMapping("/mn")
	public ResponseBean<Page<MenuVO>> list(@RequestBody RequestBean requestBean) {
		QueryWrapper<MenuVO> queryWrapper = new QueryWrapper<MenuVO>();
		if(!CommonUtil.isBlank(requestBean.getParam().get("edate"))) {
			queryWrapper.eq("m.edate", requestBean.getParam().get("edate"));
		}
		if (!CommonUtil.isBlank(requestBean.getParam().get("eid"))) {
			queryWrapper.eq("m.eid", requestBean.getParam().get("eid"));
		}
		return responseSuccess(iMenuService.findMenuAll(requestBean.getPage(),queryWrapper));
	}


}
